/**
 * @Author: 焦质晔
 * @Date: 2019/6/20
 * @Last Modified by: mikey.zhaopeng
 * @Last Modified time: 2019-11-16 20:54:51
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';
//  查询试乘试驾车型信息(试乘试驾车型查询页面)
export const searchTestDriveCars = params => axios.get(`${SERVER.CYXDMS_CLUE}/customerManage/testdrivecars`, { params });
//  试乘试驾车型跳转编辑页面
export const editQueryTestDriveCars = id => axios.get(`${SERVER.CYXDMS_CLUE}/customerManage/testdrivecars/${id}`, { id: Number(id) });
//  试乘试驾车型新增保存
export const addTestDriveCars = params => axios.post(`${SERVER.CYXDMS_CLUE}/customerManage/testdrivecars`, params);
//  试乘试驾车型编辑保存
export const editTestDriveCars = (params, id) => axios.put(`${SERVER.CYXDMS_CLUE}/customerManage/testdrivecars/${id}`, params);
//  查询车辆VIN
export const searchVINList = params => axios.get(`${SERVER.DMSCLOUD_BASEDATA}/customerManage/testdrivecars/vin/items`, { params });
//  查询试品牌列表
export const getBrandList = params => axios.get(`${SERVER.BASEDATA}/brand/getBrand`, { params });
// 查询车系下拉框
export const getSeriesList = (brandsid, params) => axios.get(`${SERVER.BASEDATA}/series/getSeriesByBrandId?brandId=${brandsid}`, { brandsid: brandsid, params: params });
//  查询车型下拉框
export const getModelList = (brandsid, seriessid, params) => axios.get(`${SERVER.BASEDATA}/model/getModelBySeriesId`, { params: { seriesId: seriessid, brandId: brandsid, ...params } });
//  查询配置下拉框
export const getPackageList = (modelId, params) => axios.get(`${SERVER.BASEDATA}/package/getPackageByModelId?modelId=${modelId}`, { modelId: modelId, params: params });

//  查询选装下拉框
export const getOptionList = (packageId, params) => axios.get(`${SERVER.BASEDATA}/option/vsOption/getOptionByPackageId/${packageId}`, { packageId: packageId, params: params });

//  跟进产品ID查询内外饰颜色
export const queryTccProductInfoById = productId => axios.get(`${SERVER.BASEDATA}/vehicleMasterInfo/queryTccProductInfoById/${productId}`);

//  查询颜色下拉框通过选装
export const getColorsListByOption = (optionId, params) => axios.get(`${SERVER.BASEDATA}/color/getColorByOptionId?optionId=${optionId}`, { optionId: optionId, params: params });;

//  查询颜色下拉框
export const getColorsList = getColorsListByOption;

// export const getBrandList = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict`, { params });
// export const getSeriesList = (brandsid, params) => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdict`, { brandsid: brandsid,params: params });
// export const getModelList = (brandsid, seriessid, params) => {
//   const url = `${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdict/${seriessid}/modelsdict`
//   return axios.get(url, {
//     seriessid: seriessid,
//     brandsid: brandsid,
//     params: params
//   })
// }
// export const getPackageList = (brandsid, seriessid, modelId, params) => {
//   const url = `${SERVER.DMSCLOUD_SYSBASEDATA}/vehicleProduct/brandsdict/${brandsid}/seriessdict/${seriessid}/modelsdict/${modelId}/packagesdict`
//   return axios.get(url, {
//     seriessid: seriessid,
//     brandsid: brandsid,
//     modelId: modelId,
//     params: params
//   })
// }
